var currentTopmenuItem = false;

function hist(tradeid, from, to)
{
//	alert("graph.php?trade=2400"+tradeid+"&start="+from+"&finish="+to);
	w = window.open("/history.php?trade=2400"+tradeid+"&start="+from+"&finish="+to,
		"history","height=550,width=820,scrollbars=no,menubar=no,status=no,location=no,fullscreen=no,directories=no,resizable=no");
	w.focus();
	var v_h=(((screen.height)/2)-(540/2));
	var v_w=(((screen.width)/2)-(820/2));

	w.moveTo(v_w,v_h);
}

function hist2(tradeid, from, to)
{
//	alert("graph.php?trade=2400"+tradeid+"&start="+from+"&finish="+to);
	w = window.open("history.php?trade=2400"+tradeid+"&start="+from+"&finish="+to,
		"history","height=520,width=820,scrollbars=no,menubar=no,status=no,location=no,fullscreen=no,directories=no,resizable=no");
	w.focus();
	var v_h=(((screen.height)/2)-(540/2));
	var v_w=(((screen.width)/2)-(820/2));

	w.moveTo(v_w,v_h);
}


function top_menu_over(num, isActive)
{
var bGround = 'background: url(../images/bg_menu_top_over1.gif) repeat-x;';
if (isActive) {	bGround = '';
}


//alert(currentTopmenuItem);

//	document.getElementById('l_'+num).style.cssText="float:left; width:15px; height:30px; background:url(../images/bg_menu_top_left.gif) no-repeat; padding:0px 0px;";
//document.getElementById('c_'+num).style.cssText="cursor: pointer; float:left; height:30px; background-color: #FFFFFF;  "+ bGround +" padding:5px 0px;";
//	document.getElementById('r_'+num).style.cssText="float:left; width:15px; height:30px; background:url(../images/bg_menu_top_right.gif) no-repeat; padding:0px 0px;";
document.getElementById('sub_'+num).style.display='block';
var menuPosY;
menuPosY = findPos(document.getElementById('pos_'+num));
//alert(menuPosY)
changeSubmenuPos(document.getElementById('sub_'+num), menuPosY);
}

function top_menu_out(num, isActive)
{
var bGround = 'background:url(../images/bg_menu_top.gif) repeat-x;';
if (isActive) bGround = '';



//	document.getElementById('l_'+num).style.cssText="float:left; width:15px; height:30px; padding:0px 0px;";
//document.getElementById('c_'+num).style.cssText="cursor: pointer; float:left; height:30px; "+ bGround +" padding:5px 0px;";

//	document.getElementById('r_'+num).style.cssText="float:left; width:15px; height:30px; padding:0px 0px;";
//window.setTimeout("document.getElementById('testdiv').style.display='none';",500);
document.getElementById('sub_'+num).style.display='none';
}

function menu_click(source)
{
	document.location.href = source;
}


function menu_over(element)
{
	element.style.backgroundColor="#F3F3F3";
}

function menu_out(element)
{
	element.style.backgroundColor="#FFFFFF";
}

function submenu_over(element,mid)
{
	for(var i=1;i<3;i++){
		document.getElementById('td'+mid+''+i+'_'+element).style.backgroundColor="#F3F3F3";
	}
	if (currentTopmenuItem) {		//document.getElementById(currentTopmenuItem).style.cssText="cursor: pointer; float:left; height:30px; background: url(../images/bg_menu_top_active) repeat-x; padding:5px 0px;";
		//alert(document.getElementById(currentTopmenuItem).style.cssText);
	}
	document.getElementById('td'+mid+'1_'+element).style.color="#708F32";
	//document.getElementById('td'+mid+'1_'+element).style.fontWeight="bold";
	document.getElementById('td'+mid+'1_'+element).style.textDecoration="underline";
}

function submenu_out(element,mid)
{
	for(var i=1;i<3;i++){
		document.getElementById('td'+mid+''+i+'_'+element).style.backgroundColor="#FFF";
	}
	if (currentTopmenuItem) {
		//document.getElementById(currentTopmenuItem).style.cssText="cursor: pointer; float:left; height:30px; background: url(../images/bg_menu_top_active.gif) repeat-x; padding:5px 0px;";
	}
	document.getElementById('td'+mid+'1_'+element).style.color="#000";
	//document.getElementById('td'+mid+'1_'+element).style.fontWeight="normal";
	document.getElementById('td'+mid+'1_'+element).style.textDecoration="none";
}

function changeSubmenuPos(element,posY)
{
	var posCorrection = 2;
	if (navigator.appName == "Netscape") posCorrection = 8;
	element.style.top = posY[1]-posCorrection;
	element.style.left = posY[0]+10;

}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function input_focus(element)
{
	element.style.cssText="border: #809EB6 1px solid; font-size: 14px; width:200px;";
}

function input_blur(element)
{
	element.style.cssText="border: #C3CDD9 1px solid; font-size: 14px; width:200px;";
}

function contactus_focus(element)
{
	element.style.cssText="border: #809EB6 1px solid; font-size: 14px; width:342px;";
}

function contactus_blur(element)
{
	element.style.cssText="border: #C3CDD9 1px solid; font-size: 14px; width:342px;";
}

////////////////////////////////////////////////////////////////////////////////////////

 function openWindow(template){
  	window.open('_notify_sample.php?t='+template,'', 'width=600, height=600, left=50, top=50, scrollbars=yes, resizable=yes');
 }

  function openImage(imageName,imgWidth,imgHeight){
  	window.open(imageName,'', 'width='+imgWidth+', height='+imgHeight+', left=50, top=50, scrollbars=yes, resizable=yes');
 }



